package com.maserb.monitor.dataCenter.communication;

import com.maserb.monitor.dataCenter.DataManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class EigenValueNetPackageHandler implements BaseNetPackageHandler {

    @Autowired
    DataManager realDataManager;

    public Boolean canHandle(MonitorMessageProtocol messageProtocol) {
        return messageProtocol.getContentType() == CommandTypeEnum.EIGENVALUE_REALTIME.getValue();
    }

    public void handle(MonitorMessageProtocol messageProtocol) {
        EigenValueNetPackage pack = EigenValueNetPackage.convert(messageProtocol.getContent());
        realDataManager.addEigenValues(pack);
    }
}
